import { http } from '@/utils/http';
import type { Folder } from '@/type/favorite';
import type { DetailArticle } from '@/type/article';
//新建分组,0 表示帖子，1 表示八股，2 表示题目
export const API_addFolder = (data:{collection_name:string,create_time:string,module:number}) => {
    return http<Folder>({
    method: 'POST',
    url: `/collection/addCollection`,
    data
  })
}
//获取收藏列表
export const API_getFolder = (module:number) => {
    return http<Folder[]>({
    method: 'GET',
    url: `/collection/getCollection?module=${module}`,
  })
}

//增添收藏 
export const API_addCollection = (data:{content_id:number,collection_name:string,collect_time:string,module:number}) => {
    return http<null>({
    method: 'POST',
        url: `/favorite/addFavorite`,
    data
  })
}

//移除收藏条目
export const API_removeCollection = (data:{content_id:number,module:number}) => {
    return http<null>({
    method: 'DELETE',
        url: `/favorite/deleteFavorite`,
    data
  })
}

// 移除收藏夹

export const API_removeFolder = (id:number) => {
    return http<null>({
    method: 'DELETE',
    url: `/collection/deleteCollection?id=${id}`,
  })
}


//获取收藏夹内条目
export const API_getCollection = (id:number) => {
    return http<DetailArticle[]>({
    method: 'GET',
    url: `/collection/getCollectionList?id=${id}`,
  })
}

//编辑收藏夹名称
export const API_updateFolderName = (id:number,name:string) => {
    return http<null>({
    method: 'POST',
    url: `/collection/editName?id=${id}&name=${name}`,
  })
}